/**
 * Multicast project Bidois Morgan & Thomas Nunes
 *
 */
package middleware;

import java.net.InetAddress;
import java.nio.channels.SocketChannel;

/**
 *
 * @author thomas
 *
 * Informations concerned to a client present in the directory: id - adress -
 * port - state
 */
public class ClientInfos {

    private int idClient;
    private InetAddress adrClient;
    private int port;
    private int alive; //1 alive 0 dead
    private SocketChannel socketChannel;
    private String name = "NoName";

    public ClientInfos(int idClient, InetAddress adrClient, int port) {
        this.idClient = idClient;
        this.adrClient = adrClient;
        this.port = port;
        //by default we start alive
        this.alive = 1;
    }
    
    public ClientInfos(int idClient, String name, InetAddress adrClient, int port) {
        this.idClient = idClient;
        this.name = name;
        this.adrClient = adrClient;
        this.port = port;
        //by default we start alive
        this.alive = 1;
    }

    public int getIdClient() {
        return idClient;
    }

    public void setIdClient(int idClient) {
        this.idClient = idClient;
    }

    public InetAddress getAdrClient() {
        return adrClient;
    }

    public void setAdrClient(InetAddress adrClient) {
        this.adrClient = adrClient;
    }

    public int getPort() {
        return port;
    }

    public void setPort(int port) {
        this.port = port;
    }

    public int getState() {
        return alive;
    }

    public void setState(int state) {
        this.alive = state;
    }

    public String getClientToSend() {
        return "" + idClient + ":"  + name + ":" + adrClient + ":" + port + ":" + alive + "|";
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public String toString() {
        return "idClient = " + idClient +"\nnameClient = " + name + "\nadrClient = " + adrClient + "\nportClient = " + port + "\netatClient = " + alive;
    }

    public SocketChannel getSocketChannel() {
        return socketChannel;
    }

    public void setSocketChannel(SocketChannel socketChannel) {
        this.socketChannel = socketChannel;
    }
}
